export const walkNaviPoints = [
  { level: 4, x: 11791430.242323, y: 3418785.560807 },
  { level: 4, x: 11791431.565243, y: 3418786.830809 },
  { level: 4, x: 11791432.358994, y: 3418787.836228 },
  { level: 4, x: 11791432.729412, y: 3418789.053314 },
  { level: 4, x: 11791433.046912, y: 3418790.534983 },
  { level: 4, x: 11791433.046912, y: 3418792.757488 },
  { level: 4, x: 11791433.470247, y: 3418794.821242 },
  { level: 4, x: 11791433.57608, y: 3418796.355828 },
  { level: 4, x: 11791433.999414, y: 3418797.625831 },
  { level: 4, x: 11791434.369832, y: 3418799.266251 },
  { level: 4, x: 11791434.898999, y: 3418800.58917 },
  { level: 4, x: 11791435.639834, y: 3418801.277088 },
  { level: 4, x: 11791437.862339, y: 3418801.806256 },
  { level: 4, x: 11791439.97901, y: 3418801.753339 },
  { level: 4, x: 11791441.884013, y: 3418801.700422 },
  { level: 4, x: 11791443.365683, y: 3418801.753339 },
  { level: 4, x: 11791445.111937, y: 3418801.700422 },
  { level: 4, x: 11791447.599025, y: 3418801.488755 },
  { level: 4, x: 11791449.292362, y: 3418801.330005 },
  { level: 4, x: 11791451.461949, y: 3418801.224171 },
  { level: 4, x: 11791453.366953, y: 3418801.277088 },
  { level: 4, x: 11791455.430707, y: 3418801.277088 },
  { level: 4, x: 11791457.811962, y: 3418801.488755 },
  { level: 4, x: 11791459.399465, y: 3418801.435839 },
  { level: 4, x: 11791461.516136, y: 3418801.277088 },
  { level: 4, x: 11791463.632807, y: 3418801.330005 },
  { level: 4, x: 11791465.908228, y: 3418801.330005 },
  { level: 4, x: 11791468.50115, y: 3418801.330005 },
  { level: 4, x: 11791470.723654, y: 3418801.330005 },
  { level: 4, x: 11791473.634077, y: 3418801.382922 },
  { level: 4, x: 11791476.279916, y: 3418801.541672 },
  { level: 4, x: 11791478.396586, y: 3418801.594589 },
  { level: 4, x: 11791480.037006, y: 3418801.753339 },
  { level: 4, x: 11791481.889093, y: 3418801.912089 }, // 偏移定位点
  { level: 6, x: 11791561.165033, y: 3418794.813304 },
  { level: 6, x: 11791561.270867, y: 3418793.384552 },
  { level: 6, x: 11791561.270867, y: 3418791.744132 },
  { level: 6, x: 11791560.318365, y: 3418790.632879 },
];

// 导航-人行真实导航模拟定位点, 第二段重新规划后路线
export const resetWalkNaviPoints = [
  { level: 4, x: 11791481.889093, y: 3418801.912089 },
  { level: 4, x: 11791483.847014, y: 3418802.017923 },
  { level: 4, x: 11791486.175352, y: 3418802.282507 },
  { level: 4, x: 11791488.027439, y: 3418802.441257 },
  { level: 4, x: 11791490.937862, y: 3418802.38834 },
  { level: 4, x: 11791493.054532, y: 3418802.176673 },
  { level: 4, x: 11791495.964955, y: 3418801.965006 },
  { level: 4, x: 11791498.134543, y: 3418801.806256 },
  { level: 4, x: 11791499.827879, y: 3418801.753339 },
  { level: 4, x: 11791501.521216, y: 3418801.647506 },
  { level: 4, x: 11791503.320056, y: 3418801.394828 },
  { level: 4, x: 11791504.828184, y: 3418800.561389 },
  { level: 4, x: 11791506.574437, y: 3418799.807325 },
  { level: 4, x: 11791507.487251, y: 3418798.73576 },
  { level: 4, x: 11791508.042877, y: 3418797.505445 },
  { level: 4, x: 11791508.320691, y: 3418795.878255 },
  { level: 4, x: 11791508.519128, y: 3418794.409814 },
  { level: 4, x: 11791508.320691, y: 3418792.8112 },
  { level: 4, x: 11791508.320691, y: 3418791.314183 },
  { level: 4, x: 11791508.598504, y: 3418789.686992 },
  { level: 4, x: 11791508.916004, y: 3418787.980426 },
  { level: 4, x: 11791508.796941, y: 3418786.035735 },
  { level: 4, x: 11791508.677879, y: 3418783.932293 },
  { level: 4, x: 11791508.400066, y: 3418782.265415 },
  { level: 4, x: 11791507.923815, y: 3418780.757287 },
  { level: 4, x: 11791507.487251, y: 3418779.566659 },
  { level: 4, x: 11791506.083303, y: 3418778.2569 },
  { level: 6, x: 11791506.083303, y: 3418778.2569 },
  { level: 6, x: 11791507.84444, y: 3418779.050721 },
  { level: 6, x: 11791509.035067, y: 3418779.88416 },
  { level: 6, x: 11791510.131851, y: 3418781.2201 },
  { level: 6, x: 11791510.503507, y: 3418782.424165 },
  { level: 6, x: 11791510.741633, y: 3418783.81323 },
  { level: 6, x: 11791511.138509, y: 3418785.519796 },
  { level: 6, x: 11791511.495697, y: 3418787.146987 },
  { level: 6, x: 11791511.77351, y: 3418788.655115 },
  { level: 6, x: 11791512.051323, y: 3418789.845742 },
  { level: 6, x: 11791512.686324, y: 3418791.19512 },
  { level: 6, x: 11791513.321326, y: 3418792.306372 },
  { level: 6, x: 11791514.789766, y: 3418792.742936 },
  { level: 6, x: 11791516.575707, y: 3418792.782623 },
  { level: 6, x: 11791518.361648, y: 3418792.623873 },
  { level: 6, x: 11791519.790401, y: 3418792.584185 },
  { level: 6, x: 11791521.496967, y: 3418792.663561 },
  { level: 6, x: 11791523.203533, y: 3418793.179499 },
  { level: 6, x: 11791525.148224, y: 3418793.854188 },
  { level: 6, x: 11791526.576977, y: 3418794.370126 },
  { level: 6, x: 11791528.283543, y: 3418795.084503 },
  { level: 6, x: 11791529.791671, y: 3418796.076692 },
  { level: 6, x: 11791531.180736, y: 3418796.949819 },
  { level: 6, x: 11791532.039075, y: 3418798.167153 },
  { level: 6, x: 11791533.125428, y: 3418799.212011 },
  { level: 6, x: 11791534.554181, y: 3418799.847012 },
  { level: 6, x: 11791536.538559, y: 3418799.847012 },
  { level: 6, x: 11791538.245125, y: 3418799.926388 },
  { level: 6, x: 11791539.991379, y: 3418800.005763 },
  { level: 6, x: 11791541.744578, y: 3418799.999148 },
  { level: 6, x: 11791543.914165, y: 3418799.999148 },
  { level: 6, x: 11791546.189587, y: 3418799.946231 },
  { level: 6, x: 11791548.253341, y: 3418799.840398 },
  { level: 6, x: 11791550.475845, y: 3418799.681648 },
  { level: 6, x: 11791553.121684, y: 3418799.522897 },
  { level: 6, x: 11791555.026688, y: 3418799.522897 },
  { level: 6, x: 11791557.196275, y: 3418799.364147 },
  { level: 6, x: 11791559.154196, y: 3418799.205397 },
  { level: 6, x: 11791560.635866, y: 3418798.411645 },
  { level: 6, x: 11791561.006283, y: 3418796.559558 },
  { level: 6, x: 11791561.165033, y: 3418794.813304 },
  { level: 6, x: 11791561.270867, y: 3418793.384552 },
  { level: 6, x: 11791561.270867, y: 3418791.744132 },
  { level: 6, x: 11791560.318365, y: 3418790.632879 },
];

/** 真实导航定时器 */
var _interval = null as any;
var _index = 0;
export function realNaviStart(points, callback) {
  if (_interval) {
    clearInterval(_interval);
    _index = 0;
  }
  // 创建定时器
  _interval = setInterval(() => {
    // 到达终点
    if (_index > points.length - 1) {
      callback(false);
      clearInterval(_interval);
      _index = 0;
      return;
    }
    let point = points[_index];
    _index++;
    callback(point);
  }, 500);
}

/** 真实导航结束 */
export function realNaviStop() {
  console.log('退出重现导航');
  if (_interval) {
    clearInterval(_interval);
    _index = 0;
  }
}
